#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys

with open('/scratch0/tmp/myourshaw/gmd28mms/vcfs/gmd28mms.analysis_ready.vcf','r') as IN, open ('/scratch0/tmp/myourshaw/gmd28mms/vcfs/gmd28mms.analysis_ready.vcf.intergenic','w') as OUT:
    for line in IN:
        if line.startswith('##'):
            continue
        fields = line.split('\t')
        if fields[0] == '#CHROM' \
        or fields[2] in ['rs10265595','rs10274643','rs10277871','rs11074669','rs111473965','rs111560241','rs112058178','rs112165219','rs112501855','rs113009390','rs113952829','rs113961158','rs11491201','rs11622473','rs11659459','rs117534519','rs117555444','rs11849940','rs12459317','rs12667117','rs12671601','rs12673744','rs12674218','rs12818444','rs12934443','rs13229078','rs13241445','rs139029076','rs139371191','rs140296505','rs140478916','rs141000026','rs141516940','rs141916752','rs1436436','rs143663742','rs143821284','rs144283627','rs145087783','rs147169683','rs147211373','rs148539547','rs150917533','rs1661940','rs16940293','rs1735192','rs17525184','rs17799502','rs1794436','rs1906270','rs2002923','rs2019670','rs2075113','rs2729355','rs2800145','rs2800146','rs2807157','rs28458422','rs28494899','rs28550929','rs34431997','rs34922633','rs35191389','rs357887','rs36129874','rs36136116','rs36149343','rs4036940','rs4077614','rs4103696','rs4795338','rs4843893','rs4843894','rs4851692','rs60434636','rs60955568','rs61391695','rs61958600','rs61958601','rs62007810','rs62126094','rs62473823','rs67650707','rs6931553','rs71384197','rs71642766','rs7245697','rs72480715','rs7256487','rs73116162','rs73299793','rs73492763','rs74002797','rs74148818','rs74148819','rs74952023','rs75366531','rs75388271','rs76287875','rs76490062','rs77625797','rs7787730','rs7791906','rs78327784','rs7852910','rs78706764','rs78962182','rs7953027','rs79972183','rs80072146','rs80161304','rs8042576','rs914744','rs9686997'] \
        :
            OUT.write(line)
